define([
  'underscore',
  'backbone',
  'models/sample_set'  
], function(_, Backbone, SampleSet) {

  var SampleSetCollection = Backbone.Collection.extend({
  	model: SampleSet,
  	url: '/samplesets',
    ajaxParams: { 
      type: 'post', 
      contentType: 'application/json', 
      dataType: 'json' 
    },

  	parse: function(response) {
  		return response.results;
  	},

    load: function(studyId) {
      // load sample sets
      var ajaxParams = _.extend({ 
          data: JSON.stringify({ study: studyId }) 
        }, this.ajaxParams);
      this.fetch(ajaxParams);
    }

  });

  return SampleSetCollection;
});
